﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Configuration;

namespace BHair.xitong
{
    public partial class frmtixing : Form
    {
        public frmtixing()
        {
            InitializeComponent();
        }
        string constr = ConfigurationManager.ConnectionStrings["BHair.Properties.Settings.BHairDBConnectionString"].ConnectionString;
        private void frmtixing_Load(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            string sql = string.Format("SELECT distinct [mid] as 卡号 ,[mname] as 姓名 ,case([msex]) when 0 then '女' when 1 then '男' end as 性别,[mphone] as 电话 ,[mjoin] as 办卡时间 ,[mbalance] as 余额,[mlastime] as 最后消费时间 ,[yxq] as 有效期 FROM [member] where ifyxq=1 and yxq<='{0}' and yxq>='{1}'", DateTime.Now.AddDays(6).ToString("yyyy-MM-dd"), DateTime.Now.ToString("yyyy-MM-dd"));
            SqlDataAdapter sda = new SqlDataAdapter(sql,conn);
            DataTable dt = new DataTable();
            sda.Fill(dt);
            dataGridView1.DataSource = dt;
            conn.Close();
        }
    }
}
